I’ll be analyzing beta diversity using four commonly used distance matrices in gut microbiome studies:
Jaccard – considers only the presence or absence of taxa (focus on rare taxa)
Bray-Curtis – incorporates relative abundances (focus on common taxa)
Unweighted UniFrac – accounts for phylogenetic distances between taxa but focuses on presence/absence
Weighted UniFrac – incorporates both phylogenetic distances and relative abundances
I’ll use these distance matrices to generate ordination plots using Principal Coordinates Analysis (PCoA) to visualize patterns of community variation over time and across hormone groups.
Since the D8s cluster together and we have reason to suspect
contamination of those samples, now I’ll filter D8 out and re-do:
Longitudinal changes in saline:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_longitud_saline_distance_matrix ~ Day, data = jaccard_longitud_saline_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 1.9333 0.22765 1.8422 0.001 ***
Residual 25 6.5591 0.77235
Total 29 8.4925 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in saline excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_longitud_saline_nod8_distance_matrix ~ Day, data = jaccard_longitud_saline_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 1.1531 0.18296 1.4928 0.024 *
Residual 20 5.1494 0.81704
Total 23 6.3024 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_longitud_pgh_distance_matrix ~ Day, data = jaccard_longitud_pgh_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 2.3273 0.26385 2.2401 0.001 ***
Residual 25 6.4934 0.73615
Total 29 8.8207 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_longitud_pgh_nod8_distance_matrix ~ Day, data = jaccard_longitud_pgh_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 1.3229 0.1996 1.6625 0.003 **
Residual 20 5.3048 0.8004
Total 23 6.6278 1.0000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_longitud_pl_distance_matrix ~ Day, data = jaccard_longitud_pl_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 1.8233 0.19936 1.5563 0.005 **
Residual 25 7.3226 0.80064
Total 29 9.1459 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_longitud_pl_nod8_distance_matrix ~ Day, data = jaccard_longitud_pl_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 1.0817 0.1535 1.2089 0.107
Residual 20 5.9648 0.8465
Total 23 7.0464 1.0000
D3 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_phylo_d3_distance_matrix ~ Hormone, data = jaccard_phylo_d3_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.5652 0.12177 1.0399 0.386
Residual 15 4.0765 0.87823
Total 17 4.6417 1.00000
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_phylo_d3_pghandsaline_distance_matrix ~ Hormone, data = jaccard_phylo_d3_pghandsaline_data)
Df SumOfSqs R2 F Pr(>F)
Model 1 0.3495 0.12185 1.3875 0.107
Residual 10 2.5188 0.87815
Total 11 2.8683 1.00000
D5 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_phylo_d5_distance_matrix ~ Hormone, data = jaccard_phylo_d5_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.4421 0.11552 0.9796 0.484
Residual 15 3.3848 0.88448
Total 17 3.8269 1.00000
D8 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = jaccard_phylo_d8_distance_matrix ~ Hormone, data = jaccard_phylo_d8_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.5380 0.11972 1.02 0.425
Residual 15 3.9561 0.88028
Total 17 4.4942 1.00000
Since the D8s cluster together and we have reason to suspect
contamination of those samples, now I’ll filter D8 out and re-do:
Longitudinal changes in saline:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_longitud_saline_distance_matrix ~ Day, data = bc_longitud_saline_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 1.1286 0.34198 3.2481 0.001 ***
Residual 25 2.1716 0.65802
Total 29 3.3002 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in saline excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_longitud_saline_nod8_distance_matrix ~ Day, data = bc_longitud_saline_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.63051 0.27611 2.5428 0.005 **
Residual 20 1.65305 0.72389
Total 23 2.28357 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_longitud_pgh_distance_matrix ~ Day, data = bc_longitud_pgh_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 1.4298 0.3745 3.742 0.001 ***
Residual 25 2.3881 0.6255
Total 29 3.8178 1.0000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_longitud_pgh_nod8_distance_matrix ~ Day, data = bc_longitud_pgh_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.73498 0.26694 2.4276 0.005 **
Residual 20 2.01837 0.73306
Total 23 2.75335 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_longitud_pl_distance_matrix ~ Day, data = bc_longitud_pl_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 1.1638 0.28962 2.5482 0.001 ***
Residual 25 2.8545 0.71038
Total 29 4.0184 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_longitud_pl_nod8_distance_matrix ~ Day, data = bc_longitud_pl_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.65641 0.21504 1.8263 0.039 *
Residual 20 2.39611 0.78496
Total 23 3.05252 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
D3 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_phylo_d3_distance_matrix ~ Hormone, data = bc_phylo_d3_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.21906 0.13519 1.1724 0.298
Residual 15 1.40136 0.86481
Total 17 1.62042 1.00000
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_phylo_d3_pghandsaline_distance_matrix ~ Hormone, data = bc_phylo_d3_pghandsaline_data)
Df SumOfSqs R2 F Pr(>F)
Model 1 0.15969 0.1705 2.0555 0.087 .
Residual 10 0.77688 0.8295
Total 11 0.93656 1.0000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
D5 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_phylo_d5_distance_matrix ~ Hormone, data = bc_phylo_d5_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.11972 0.10938 0.9211 0.511
Residual 15 0.97478 0.89062
Total 17 1.09450 1.00000
D8 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = bc_phylo_d8_distance_matrix ~ Hormone, data = bc_phylo_d8_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.18981 0.12353 1.0571 0.412
Residual 15 1.34668 0.87647
Total 17 1.53649 1.00000
Since the D8s cluster together and we have reason to suspect
contamination of those samples, now I’ll filter D8 out and re-do:
Longitudinal changes in saline:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_longitud_saline_distance_matrix ~ Day, data = unifrac_longitud_saline_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 0.09385 0.26276 2.2276 0.001 ***
Residual 25 0.26332 0.73724
Total 29 0.35717 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in saline excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_longitud_saline_nod8_distance_matrix ~ Day, data = unifrac_longitud_saline_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.048339 0.16754 1.3418 0.071 .
Residual 20 0.240176 0.83246
Total 23 0.288515 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_longitud_pgh_distance_matrix ~ Day, data = unifrac_longitud_pgh_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 0.10451 0.28253 2.4611 0.002 **
Residual 25 0.26540 0.71747
Total 29 0.36990 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_longitud_pgh_nod8_distance_matrix ~ Day, data = unifrac_longitud_pgh_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.049562 0.17479 1.4121 0.052 .
Residual 20 0.233980 0.82521
Total 23 0.283542 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_longitud_pl_distance_matrix ~ Day, data = unifrac_longitud_pl_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 0.09516 0.23233 1.8915 0.006 **
Residual 25 0.31445 0.76767
Total 29 0.40961 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_longitud_pl_nod8_distance_matrix ~ Day, data = unifrac_longitud_pl_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.04652 0.14532 1.1335 0.258
Residual 20 0.27361 0.85468
Total 23 0.32014 1.00000
D3 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_phylo_d3_distance_matrix ~ Hormone, data = unifrac_phylo_d3_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.03878 0.1534 1.359 0.098 .
Residual 15 0.21402 0.8466
Total 17 0.25280 1.0000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_phylo_d3_pghandsaline_distance_matrix ~ Hormone, data = unifrac_phylo_d3_pghandsaline_data)
Df SumOfSqs R2 F Pr(>F)
Model 1 0.016257 0.10637 1.1904 0.267
Residual 10 0.136573 0.89363
Total 11 0.152830 1.00000
D5 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_phylo_d5_distance_matrix ~ Hormone, data = unifrac_phylo_d5_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.028717 0.13159 1.1365 0.238
Residual 15 0.189509 0.86841
Total 17 0.218226 1.00000
D8 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = unifrac_phylo_d8_distance_matrix ~ Hormone, data = unifrac_phylo_d8_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.015061 0.13636 1.1841 0.177
Residual 15 0.095393 0.86364
Total 17 0.110454 1.00000
Since the D8s cluster together and we have reason to suspect
contamination of those samples, now I’ll filter D8 out and re-do:
Longitudinal changes in saline:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_longitud_saline_distance_matrix ~ Day, data = wunifrac_longitud_saline_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 0.14232 0.26768 2.2846 0.044 *
Residual 25 0.38935 0.73232
Total 29 0.53167 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in saline excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_longitud_saline_nod8_distance_matrix ~ Day, data = wunifrac_longitud_saline_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.12355 0.30314 2.9 0.018 *
Residual 20 0.28403 0.69686
Total 23 0.40759 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_longitud_pgh_distance_matrix ~ Day, data = wunifrac_longitud_pgh_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 0.13844 0.23717 1.9431 0.067 .
Residual 25 0.44527 0.76283
Total 29 0.58371 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PGH excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_longitud_pgh_nod8_distance_matrix ~ Day, data = wunifrac_longitud_pgh_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.12596 0.25603 2.2942 0.048 *
Residual 20 0.36601 0.74397
Total 23 0.49197 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_longitud_pl_distance_matrix ~ Day, data = wunifrac_longitud_pl_data)
Df SumOfSqs R2 F Pr(>F)
Model 4 0.14866 0.25557 2.1457 0.023 *
Residual 25 0.43303 0.74443
Total 29 0.58169 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Longitudinal changes in PL excluding D8:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_longitud_pl_nod8_distance_matrix ~ Day, data = wunifrac_longitud_pl_nod8_data)
Df SumOfSqs R2 F Pr(>F)
Model 3 0.14569 0.27661 2.5492 0.017 *
Residual 20 0.38101 0.72339
Total 23 0.52670 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
D3 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_phylo_d3_distance_matrix ~ Hormone, data = wunifrac_phylo_d3_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.024242 0.09833 0.8179 0.578
Residual 15 0.222289 0.90167
Total 17 0.246531 1.00000
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_phylo_d3_pghandsaline_distance_matrix ~ Hormone, data = wunifrac_phylo_d3_pghandsaline_data)
Df SumOfSqs R2 F Pr(>F)
Model 1 0.015955 0.11451 1.2931 0.277
Residual 10 0.123383 0.88549
Total 11 0.139338 1.00000
D5 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_phylo_d5_distance_matrix ~ Hormone, data = wunifrac_phylo_d5_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.011666 0.08038 0.6556 0.705
Residual 15 0.133464 0.91962
Total 17 0.145130 1.00000
D8 clustering:
STATISTICAL ANALYSIS:
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999
adonis2(formula = wunifrac_phylo_d8_distance_matrix ~ Hormone, data = wunifrac_phylo_d8_data)
Df SumOfSqs R2 F Pr(>F)
Model 2 0.033458 0.12389 1.0606 0.374
Residual 15 0.236595 0.87611
Total 17 0.270053 1.00000
NOTE: For most distance matrices, I was able to get significant clustering by hormone group when including multiple intervention days and accounting for each individual mouse as a random effect. However, this was not resulting in R^2 values any different than when mouse ID was the only dependent variable included, so I believe it was driving the significance and creating the illusion of significant group differences. I’d love to talk through those stats methods more to ensure I’m doing everything correctly.
Key Takeaways: While there was a significant pattern of PERMANOVA separation by Day within each hormone group, indicating a longitudinal effect, there was no consistent pattern of separation by hormone group at any time point.
I can extract the data on principal coordinates from the “vectors” part of an ordination object. I can then plot these vectors across other variables, like time.
I’ll start with plotting these in terms of Bray-Curtis ordination:
Time can also be plotted against axes derived from our other distance matrices.